var xmlhttp;
function loadXMLDoc(url,cfunc)
{
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {// IE6, IE5 代码
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=cfunc;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}

function searchUser()
{
	var input = document.getElementById("input").value;
	var condition = document.getElementById("condition").value;
	loadXMLDoc("searchUser?input="+input+"&condition="+condition,function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("datalist").innerHTML=xmlhttp.responseText;
		}
	});
}

function showall()
{
	loadXMLDoc("showallUser",function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("datalist").innerHTML=xmlhttp.responseText;
		}
	});
}

function searchLog()
{
	
	var input = document.getElementById("input").value;
	var condition = document.getElementById("condition").value;
	loadXMLDoc("searchLog?input="+input+"&condition="+condition,function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("datalist").innerHTML=xmlhttp.responseText;
		}
	});
}

function showallLog()
{
	
	loadXMLDoc("showallLog",function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("datalist").innerHTML=xmlhttp.responseText;
		}
	});
}

function ProtolControl(type)
{
	
	loadXMLDoc("ProtolControl?type="+type,function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			if(type==1){
				document.getElementById("smtpstate").innerHTML="启动";
			}else if(type==2){
				document.getElementById("smtpstate").innerHTML="停止";
			}else if(type==3){
				document.getElementById("pop3state").innerHTML="启动";
			}else if(type==4){
				document.getElementById("pop3state").innerHTML="停止";
			}
		}
	});
}
